Chat2Desk

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val clientPhone: String?

Client key for current connection

Link copied to clipboard
open override val connectionStatus: StateFlow<ConnectionState?>

Current connection status.

Link copied to clipboard
open override val customFields: StateFlow<List<CustomField>>

List of custom fields, declared on company.

Link copied to clipboard
open override val error: StateFlow<Throwable?>

Flow with errors.

Link copied to clipboard
open override val messages: StateFlow<List<Message>>

List of Message.

Link copied to clipboard
open override val operator: StateFlow<Operator?>

Current connected operator.

Functions

Link copied to clipboard
open override fun close()

Close this chat2desk and all underlying resources.

Link copied to clipboard
open suspend override fun delivery()

Mark last message is delivery.

open suspend override fun delivery(id: String)

Mark message is delivery.

Link copied to clipboard
open suspend override fun fetchMessages()

Fetch all messages from Chat2Desk service. If you want to receive new message we recommend to use IChat2Desk.fetchNewMessages After fetching process the property IChat2Desk.messages will be updated.

open suspend override fun fetchMessages(loadMore: Boolean?, clear: Boolean?)
Link copied to clipboard
open suspend override fun fetchNewMessages()

Fetch new messages. This method receive new messages from server if their exists After fetching process the property IChat2Desk.messages will be updated.

Link copied to clipboard
open suspend override fun flushAll()

Remove all library data like IChat2Desk.messages, IChat2Desk.clientPhone. It will also stop the current connection to the service. After reset, you need to call IChat2Desk.start to start using the library.

Link copied to clipboard
open override fun fullTextSearch(query: String): List<Message>

Full-text search messages by text.

Link copied to clipboard
open suspend override fun read()

Mark chat is read.

Link copied to clipboard
open suspend override fun resendMessage(message: Message)

Resend message if it have status DeliveryStatus.NOT_DELIVERED.

Link copied to clipboard
open override fun searchByQuery(query: String, options: SearchOptions?): List<Message>

Search messages by query

Link copied to clipboard
open suspend override fun sendClientParams(name: String, phone: String, fieldSet: Map<Int, String>)

Send client params. You can send name and phone by default. If you want to send other client field, which declared in Chat2Desk service, you need to use CustomField.id property from IChat2Desk.customFields as key and your value

Link copied to clipboard
open suspend override fun sendMessage(msg: String)

Send the simple message with text.

open suspend override fun sendMessage(msg: String, attachedFile: AttachedFile)

Send the message with attachment.

Link copied to clipboard
open suspend override fun start(): String?

Connect to Chat2Desk and start the chat.

open suspend override fun start(clientId: String?): String?

Connect to Chat2Desk with client key and start the chat.

Link copied to clipboard
open suspend override fun stop()

Disconnect from Chat2Desk.

Link copied to clipboard

Wrapper for connection status

Link copied to clipboard

Wrapper for custom fields list

Link copied to clipboard

Wrapper for errors

Link copied to clipboard

Wrapper for message list

Link copied to clipboard

Wrapper for operator